<?php

namespace app\api\validate;

use think\Validate;

class Address extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name'  =>  'require|max:10',
        'mobile'  =>  'require',
        'region_type'  =>  'require|integer|in:1,2',
        'address'  =>  'require|max:50',
        'default_status'  =>  'in:0,1',
        'id'  =>  'require|integer|gt:0',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require'  =>  '請輸入姓名',
        'name.max'  =>  '姓名不得超過10個字符',
        'mobile.require'  =>  '請輸入手機號碼',
        'region_type.require'  =>  '請選擇地區',
        'region_type.integer'  =>  '地區類型錯誤',
        'region_type.in'  =>  '地區類型錯誤',
        'address.require'  =>  '請輸入地址',
        'address.max'  =>  '詳細地址不得超過50個字符',
        'default_status.in'  =>  '默認地址類型錯誤',
        'id.require'  =>  '請求參數不能為空',
        'id.integer'  =>   '請求參數類型錯誤',
        'id.gt'  =>   '請求參數類型錯誤',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['name','mobile','region_type','address','default_status'],
        'edit'  => ['id','name','mobile','region_type','address','default_status'],
        'delete'  => ['id'],
        'default'  => ['id','default_status']
    ];
    
}
